export const schema = {
    type: "page",
    title: "项目信息查看",
    initApi: "/api/project/${id}",
    body: [
        {
            type: "nav",
            stacked: false,
            links: [
                {
                    label: "查看",
                    to: "/project/view/${id}"
                },
                {
                    label: "编辑",
                    visibleOn: 'acl.can("project:create")',
                    to: "/project/edit/${id}"
                },
                {
                    label: "签到码",
                    to: "/project/checkin/${id}",
                    // acl: "project:create",
                    visibleOn: 'acl.can("project:create")',
                },
                {
                    label: "录用管理",
                    to: "/project/hire/${id}",
                    visibleOn: 'acl.can("project:create")',
                    // acl: "project:create"
                },
                {
                    label: "志愿时长",
                    to: "/project/work/${id}",
                    visibleOn: 'acl.can("project:create")',
                    // acl: "project:create"
                }
            ]
        },

        {
            type: "wrapper",
            className: "b-l b-b b-r bg-white no-padder",
            body: {
                className: "m-t-md",
                title: "",
                panelClassName: "no-border no-shadow",
                submitText: "",
                type: "form",
                mode: "horizontal",
                fieldSet: [
                    {
                        title: "基本信息",
                        controls: [
                            {
                                type: "static",
                                name: "org_id",
                                label: "所属机构",
                                tpl: "${org.name}"
                            },

                            {
                                type: "static",
                                name: "team_id",
                                label: "所属团队",
                                tpl: "${team.name}"
                            },
                            {
                                type: "static-image",
                                label: "海报",
                                name: "list_photo"
                            },
                            {
                                label: "项目名称",
                                name: "name",
                                type: "static"
                            },

                            {
                                type: "static",
                                name: "service_target",
                                label: "服务对象",
                                tpl: '<% data.service_target && data.service_target.split(",").map(function(name) {%><span class="label label-info m-r-xs"><%= name %></span><%}); %>'
                            },

                            {
                                type: "region",
                                name: "region",
                                label: "区域",
                                ignoreAddress: true,
                                disabled: true
                            },

                            {
                                type: "map",
                                name: "address",
                                label: "服务地点",
                                disabled: true
                            },

                            [
                                {
                                    label: "项目开始日期",
                                    type: "date",
                                    name: "begin",
                                    disabled: true
                                },

                                {
                                    label: "到",
                                    labelClassName: "w-1x m-l-n",
                                    type: "date",
                                    name: "end",
                                    disabled: true
                                }
                            ],

                            {
                                label: "招募截止日期",
                                type: "date",
                                name: "join_end",
                                disabled: true
                            },

                            {
                                label: "计划招募人数",
                                name: "people_count",
                                type: "static",
                                width: 100,
                                tpl: '${people_count}人'
                            },

                            {
                                type: "static",
                                name: "project_type",
                                label: "服务类型",
                                tpl: '<% data.project_type && data.project_type.split(",").map(function(name) {%><span class="label label-info m-r-xs"><%= name %></span><%}); %>'
                            },

                            {
                                type: "static",
                                name: "volunteer_security",
                                label: "志愿者保障",
                                tpl: '<% data.volunteer_security && data.volunteer_security.split(",").map(function(name) {%><span class="label label-info m-r-xs"><%= name %></span><%}); %>'
                            },

                            {
                                type: "rich-text",
                                name: "content",
                                label: "项目概述",
                                disabled: true
                            },

                            {
                                type: "static-image",
                                name: "photo",
                                label: "项目图片",
                                multiple: true,
                                imageWrapClassName: 'thumb-lg m-r-xs',
                                popOver: {
                                    title: "",
                                    body:
                                    '<div class="w-xx-xxl"><% data.photo && data.photo.split(",").map(function(src) { %><img class="w-full m-b-sm" src="<%= src %>" /><% }) %></div>'
                                }
                            }
                        ]
                    },

                    {
                        title: "联系人信息",
                        controls: [
                            {
                                type: "static",
                                label: "联系人姓名",
                                name: "contact_name"
                            },

                            {
                                type: "static",
                                label: "联系人手机",
                                name: "contact_phone",
                                tpl: '<% if (parseInt(data.contact_phone_public, 10)) { %><%= data.contact_phone %><% } else { %>...<% } %>'
                            },

                            // {
                            //     type: "static",
                            //     label: "办公电话",
                            //     name: "work_tel",
                            //     tpl: '<% if (parseInt(data.work_tel_public, 10)) { %><%= data.work_tel %><% } else { %>...<% } %>'
                            // },
                            //
                            // {
                            //     type: "static",
                            //     label: "办公邮箱",
                            //     name: "work_email"
                            // }
                        ]
                    },
                    {
                        title: "报名需要收集的志愿者其他信息",
                        subTitle: "如需要报名的志愿者提供除注册填写的信息之外的信息，请在这里添加设置",
                        className: 'm-t-lg',
                        controls: [
                            {
                                type: 'combo',
                                name: 'custom_config',
                                multiple: true,
                                // dragable: true,
                                // multiLine: true,
                                noOffset: true,
                                maxLength: 10,
                                disabled: true,
                                controls: [
                                    // {
                                    //     name: 'key',
                                    //     placeholder: '标识',
                                    //     type: 'text'
                                    // },
                                    {
                                        name: 'label',
                                        placeholder: '标题',
                                        type: 'text',
                                        // required: true,
                                        validations: 'isRequired',
                                    },
                                    {
                                        type: 'select',
                                        name: 'type',
                                        placeholder: "类别",
                                        // required: true,
                                        validations: 'isRequired',

                                        options: [
                                            {
                                                value: '1',
                                                label: '单项选择'
                                            },

                                            {
                                                value: '2',
                                                label: '多项选择'
                                            },

                                            {
                                                value: '3',
                                                label: '单行输入'
                                            },

                                            {
                                                value: '4',
                                                label: '多行输入'
                                            },

                                            {
                                                value: '5',
                                                label: '上传图片'
                                            },

                                            {
                                                value: '6',
                                                label: '日期控件'
                                            },

                                            {
                                                value: '7',
                                                label: '时间控件'
                                            }
                                        ]
                                    },

                                    {
                                        type: "text",
                                        name: "options",
                                        placeholder: "选项内容，用英文逗号分隔",
                                        visibleOn: "data.type == 1 || data.type == 2",
                                        validations: 'isPro',

                                        // desc: "请用英文标点\",\"分格",
                                        // requiredOn: "data.type == 1 || data.type == 2",
                                    },
                                    {
                                        type: 'select',
                                        name: 'is_required',
                                        placeholder: "是否必填",
                                        // required: true,
                                        validations: 'isRequired',

                                        options: [
                                            {
                                                value: '1',
                                                label: '是'
                                            },

                                            {
                                                value: '0',
                                                label: '否'
                                            },
                                        ],
                                    }
                                ]
                            },
                        ],
                    },
                    // {
                    //     title: "添加收款信息",
                    //     subTitle: "如该活动需要收取报名费，请在这里添加设置",
                    //     className: 'm-t-lg',
                    //     controls: [
                    //         {
                    //             type: 'combo',
                    //             name: 'custom_payment_config',
                    //             multiple: true,
                    //             // dragable: true,
                    //             // multiLine: true,
                    //             noOffset: true,
                    //             disabled: true,
                    //             maxLength: 10,
                    //             controls: [
                    //                 {
                    //                     name: 'amount',
                    //                     placeholder: '金额',
                    //                     validations: 'isNumeric,isRequired',
                    //                     // required: true,
                    //                     type: 'text'
                    //                 },
                    //                 {
                    //                     name: 'label',
                    //                     placeholder: '商品名称',
                    //                     // required: true,
                    //                     validations: 'isRequired',
                    //                     type: 'text'
                    //                 },
                    //                 // {
                    //                 //     name: 'count',
                    //                 //     placeholder: '数量',
                    //                 //     validations: 'isNumeric',
                    //                 //     required: true,
                    //                 //     type: 'text'
                    //                 // },
                    //                 {
                    //                     type: 'select',
                    //                     name: 'is_required',
                    //                     placeholder: "是否必填",
                    //                     // required: true,
                    //                     validations: 'isRequired',
                    //                     options: [
                    //                         {
                    //                             value: '1',
                    //                             label: '是'
                    //                         },
                    //
                    //                         {
                    //                             value: '0',
                    //                             label: '否'
                    //                         },
                    //                     ],
                    //                 }
                    //             ],
                    //         }
                    //     ],
                    // },
                ]
            }
        }
    ]
};
